Relational Semantics of Local Variable Scoping
نویسندگان
چکیده
Most previous work on the equivalence of programs in the presence of local state has involved intricate memory modeling and the notion of contextual (observable) equivalence. We show how relational semantics can be used to avoid these complications. We define a notion of local variable scoping, along with a purely compositional semantics based on binary relations, such that all contextual considerations are completely encapsulated in the semantics. We then give an axiom system for program equivalence in the presence of local state that avoids all mention of memory or context and that does not use semantic arguments. The system is complete relative to the underlying flat equational theory. We also indicate briefly how the semantics can be extended to include higher-order functions.
منابع مشابه
Local Variable Scoping and Kleene Algebra with Tests
We explore the power of relational semantics and equational reasoning in the style of Kleene algebra for analyzing programs with mutable, statically scoped local variables. We provide (i) a fully compositional relational semantics for a first-order programming language with constructs for local variable declaration and destructive update; and (ii) an equational proof system based on Kleene alge...
متن کاملCapturing pointer semantics and scoping rules
The purpose of this paper is to present a relation-based semantic deenition of imperative programming languages, that captures two arcane aspects: pointers and scoping rules. These two aspects are captured with a single mathematical device, which deals with an original deenition of the notion of state. 1 Background We consider an imperative, block-structured, programming language, such as C, an...
متن کاملAn Operational Semantics of Lexically-Scoped Dynamic Variables
Lexical and dynamic scoping are the two primary approaches to variable binding in functional programming languages. While medieval Lisp dialects commonly featured dynamic scoping, most languages today emphasize lexical scoping. This is a sensible choice: lexical scoping enables local reasoning about programs at the source code level. Nonetheless, dynamic variables are more appropriate for certa...
متن کاملRelational Semantics for Higher-Order Functional Programs
Much work has been done on the semantics of programs with local state. Most of this work involves complex storage modeling with pointers and memory cells, complicated categorical constructions, and reasoning in the presence of context. We show how a relatively simple relational semantics can be used to avoid these complications. We provide a natural relational semantics for a programming langua...
متن کاملRelational Semantics for Higher-Order Programs
Most previous work on the semantics of higher-order programs with local state involves complex storage modeling with pointers and memory cells, complicated categorical constructions, or reasoning in the presence of context. In this paper we show how a relatively simple relational semantics can be used to avoid these complications. We provide a natural relational semantics for a programming lang...
متن کامل